#ifndef CHOOSEFRIENDSDIALOG_H
#define CHOOSEFRIENDSDIALOG_H
#include<QHBoxLayout>
#include <QDialog>
#include <QWidget>
#include<QCheckBox>
#include<QLabel>
//////////////////
//可供选择的一个好友元素（单选框+头像+名字）
class choosefriendsdialog;
class choosefriendItem:public QWidget
{
    Q_OBJECT
public:
    choosefriendItem(choosefriendsdialog*owner,const QString&userid,const QIcon &avatar, const QString &name, bool cheched);
    //下面这三个是搭配在一起的
    void paintEvent(QPaintEvent*event);
    void enterEvent(QEnterEvent *event);
    void leaveEvent(QEvent*event);
    QString&getuserid()
    {
        return userId;
    }
    QCheckBox* getcheckBox()
    {
         return checkBox;
    }
private:
    QCheckBox* checkBox;
    QPushButton*avatarBtn;
    QLabel*namelabel;
    //鼠标是否进入
    bool isHover=false;
    choosefriendsdialog*owner;
    QString userId;
};

//////////////////
//...里面的添加好友按钮的跳转
/////////////////
class choosefriendsdialog : public QDialog
{
    Q_OBJECT
public:
    choosefriendsdialog(QWidget*parent);
   void initleft(QHBoxLayout*layout);
   void initright(QHBoxLayout*layout);
   void addFriendItem(const QString&userid,const QIcon&avatar,const QString&name,bool cheched);
   void addSelectedFriendItem(const QString&userid,const QIcon&avatar,const QString&name);
   void deleteItem(const QString&userId);
private:
    QWidget*leftWidget;
    QWidget*rightWidget;
};

#endif // CHOOSEFRIENDSDIALOG_H
